package com.lagou.vo;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpSession;
import java.io.Serializable;

/**
 * @author: wudong
 * @create: 2021-08-03 17:13
 **/
public class MachineStatus implements Serializable {
    private String name;

    private int port;

    private String sessionId;

    public static MachineStatus build(ServletRequest request, HttpSession httpSession){
        MachineStatus machineStatus = new MachineStatus();
        machineStatus.setName("登陆服务器");
        machineStatus.setPort(request.getLocalPort());
        machineStatus.setSessionId(httpSession.getId());
        return machineStatus;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public String getSessionId() {
        return sessionId;
    }

    public void setSessionId(String sessionId) {
        this.sessionId = sessionId;
    }

    @Override
    public String toString() {
        return "MachineStatus{" +
                "name='" + name + '\'' +
                ", port=" + port +
                ", sessionId='" + sessionId + '\'' +
                '}';
    }
}
